package com.wzdigit.wms.basic.enums.writeback;
/*
 * @Author:yangwenbiao
 * @Date 2020/7/30 5:46 PM
 * @version 1.0
 */


import com.wzdigit.wms.basic.enums.BaseEnum;
import com.wzdigit.wms.basic.util.enums.SystemModuleEnum;

import java.util.ArrayList;
import java.util.List;

public enum TopicEnum implements BaseEnum {

    /**
     * 回传主题
     */
    //成品——SAP
    TOPIC_SAP_DELIVERY(101, "SAP_交货单","回传主题_成品", SystemModuleEnum.WMS),
    TOPIC_SAP_TRANSFER(102, "SAP_调拨单","回传主题_成品",SystemModuleEnum.WMS),
    TOPIC_SAP_MATERIAL_WRITE_BACK(103, "SAP_领料回写","回传主题_成品",SystemModuleEnum.WMS),
    TOPIC_SAP_SEND_CHECK(104, "SAP_报检接口","回传主题_成品",SystemModuleEnum.WMS),
    TOPIC_SAP_WAIT_CHECK_IN_INSTORAGE(105, "SAP_待检入库接口","回传主题_成品",SystemModuleEnum.WMS),
    TOPIC_SAP_SALES_RETURN(106, "SAP_退货接口","回传主题_成品",SystemModuleEnum.WMS),
    //成品——SAP

    //原材料_SAP
    TOPIC_SAP_WAIT_CHECK_IN_STORE(107, "SAP_待检入库","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_CHECK_IN_STORE(108, "SAP_判检入库","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_GET_AND_RETURN(109, "SAP_生产领退料","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_PURCHASE_ORDER(110, "SAP_采购订单","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_GET_STORE(111, "SAP_库存获取","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_STORE_CHECK_PROOF(112, "SAP_库存盘点凭证","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_OUT_STORE(113, "SAP_出库单回写","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_WMS_BILL_STATUS(114, "SAP_单据状态回写","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_MATERIAL_REPLACE(115, "SAP_物料替代","回传主题_原材料",SystemModuleEnum.RAW),
    TOPIC_SAP_DELIVERY_WRITE_OFF(116, "SAP_交货单冲销","回传主题_原材料",SystemModuleEnum.RAW),
    //原材料_SAP

    //成品——OMS
    TOPIC_OMS_ACTUAL_CTNR(201, "OMS_实际装柜清单","回传主题_成品",SystemModuleEnum.WMS),

    //成品——TMS
    TOPIC_TMS_TAKE_OVER(301, "TMS_出库交接单","回传主题_成品",SystemModuleEnum.TMS);




    /**
     * 枚举值
     */
    public int code;

    /**
     * 枚举名称
     */
    public String enumName;

    /**
     * 枚举实体类属性描述
     *
     * @return
     */
    public String description;

    public SystemModuleEnum  systemModule;

    TopicEnum(int code, String enumName) {
        this.code = code;
        this.enumName = enumName;
    }

    TopicEnum(int code, String enumName, String description) {
        this.code = code;
        this.enumName = enumName;
        this.description = description;
    }

    TopicEnum(int code, String enumName, String description,SystemModuleEnum systemModule) {
        this.code = code;
        this.enumName = enumName;
        this.description = description;
        this.systemModule = systemModule;
    }

    public int getCode() {
        return code;
    }

    public  final String getEnumName() {
        return enumName;
    }

    public String getDescription() {
        return description;
    }

    public static TopicEnum getEnumByCode(int enumCode) {
        TopicEnum[] values = TopicEnum.values();
        TopicEnum repairEnum = null;

        for (TopicEnum value : values) {
            if (value.getCode() == enumCode) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }

    public static TopicEnum getEnumByName(String enumName) {
        TopicEnum[] values = TopicEnum.values();
        TopicEnum repairEnum = null;

        for (TopicEnum value : values) {
            if (value.getEnumName().equals(enumName)) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }
    /**
        * 获取对应系统的枚举
        * @return java.util.List<java.lang.String>
        * @author shuaic
        * @date 2021/9/14 10:23
    */
    public static List<String> getEnumNameBySystemModule(SystemModuleEnum systemModule){
        List<String> list = new ArrayList<>();
        TopicEnum[] values = TopicEnum.values();
        for(TopicEnum item : values){
            if(item.systemModule == systemModule){
                list.add(item.getEnumName());
            }
        }

        return list;
    }
}
